For basic regular expressions, the pattern is matched to the exact recognition results. For example, to find the exact string "123", the regular expression pattern is "123".
If the masking pattern includes special characters, then each of these characters require escaping.
- asterisk ("*", U+002A)
- plus sign ("+", U+002B)
- question mark ("?", U+003F)
- period (".", U+002E)
- left square bracket ("[", U+005B)
- right square bracket ("]", U+005D)
- left curly bracket ("{", U+007B)
- right curly bracket ("}", U+007D)
- vertical bar ("|", U+007C)
- left parentheses ("(", U+0028)
- right parentheses (")", U+0029)
- dash ("-", U+002D)
- dollar sign ("$", U+0024)
To escape the special characters, precede them with a backslash ("\", U+005C) character. For example, to define the string "$123", the pattern is "\$123".
In C and C++, the backslash ("\", U+005C) implies an escape character, so you have to type "\\.123". In other words, to use a backslash in the search pattern, simply escape it with a backslash. For example, to specify the string "\123", the necessary pattern is "\\123".
The period "." matches any single character.